/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.eventos.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author lizardo
 */
@Entity
@Table(name = "eca_detalle_material")
@NamedQueries({@NamedQuery(name = "DetalleMaterial.findAll", query = "SELECT d FROM DetalleMaterial d"), @NamedQuery(name = "DetalleMaterial.findByDmaCodigo", query = "SELECT d FROM DetalleMaterial d WHERE d.dmaCodigo = :dmaCodigo"), @NamedQuery(name = "DetalleMaterial.findByDmaContenido", query = "SELECT d FROM DetalleMaterial d WHERE d.dmaContenido = :dmaContenido")})
public class DetalleMaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "dma_codigo")
    private Integer dmaCodigo;
    @Basic(optional = false)
    @Column(name = "dma_contenido")
    private String dmaContenido;
    @JoinColumn(name = "mac_codigo", referencedColumnName = "mac_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private MaterialAcademico macCodigo;

    public DetalleMaterial() {
    }

    public DetalleMaterial(Integer dmaCodigo) {
        this.dmaCodigo = dmaCodigo;
    }

    public DetalleMaterial(Integer dmaCodigo, String dmaContenido) {
        this.dmaCodigo = dmaCodigo;
        this.dmaContenido = dmaContenido;
    }

    public Integer getDmaCodigo() {
        return dmaCodigo;
    }

    public void setDmaCodigo(Integer dmaCodigo) {
        this.dmaCodigo = dmaCodigo;
    }

    public String getDmaContenido() {
        return dmaContenido;
    }

    public void setDmaContenido(String dmaContenido) {
        this.dmaContenido = dmaContenido;
    }

    public MaterialAcademico getMacCodigo() {
        return macCodigo;
    }

    public void setMacCodigo(MaterialAcademico macCodigo) {
        this.macCodigo = macCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dmaCodigo != null ? dmaCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleMaterial)) {
            return false;
        }
        DetalleMaterial other = (DetalleMaterial) object;
        if ((this.dmaCodigo == null && other.dmaCodigo != null) || (this.dmaCodigo != null && !this.dmaCodigo.equals(other.dmaCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.eventos.be.DetalleMaterial[dmaCodigo=" + dmaCodigo + "]";
    }

}
